From: Florian Müllner Date: Sat, 16 Nov 2019 12:48:35 +0000 (+0100) Subject: keyboard: Try harder to find a matching layout X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~408 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c1ec7b2ffa5b4e5f8b6a31d9cb3eaed0712bd03a;p=gnome-shell.git keyboard: Try harder to find a matching layout While we support a reasonable list of layouts nowadays, we don't include many variants like `fr+oss`. Instead of directly falling back to the `us` layout, try stripping the variant first, as the base layout is likely closer to the expectation than `us`. https://gitlab.gnome.org/GNOME/gnome-shell/issues/1907 --- diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 8e1f34bac..c6984cc36 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -478,10 +478,17 @@ var Key = GObject.registerClass({ var KeyboardModel = class { constructor(groupName) { - try { - this._model = this._loadModel(groupName); - } catch (e) { - this._model = this._loadModel('us'); + let names = [groupName]; + if (names.includes('+')) + names.push(groupName.replace(/\+.*/, '')); + names.push('us'); + + for (let i = 0; i < names.length; i++) { + try { + this._model = this._loadModel(names[i]); + break; + } catch (e) { + } } }